package gxprod.androidai.regex;

import gxprod.androidai.functions.Function;
/**
 * The result generated to represent a match to the most recent command. 
 * @author josh
 *
 */
public class MatchResult implements Comparable<MatchResult>{

	public NamedMatcher Matcher;
	public float Confidence;
	public int MatchIndex;
	public Function Function;

	public MatchResult(NamedMatcher matcher, int matchIndex, float confidence, Function function) {
		Matcher = matcher;
		MatchIndex = matchIndex;
		Confidence = confidence;
		Function = function;
	}

	public MatchResult() {
		Matcher = null;
		Confidence = -1.0f;
	}

	public boolean isBetterMatch(MatchResult result) {
		return (result.Confidence > 0) && (result.Confidence >= Confidence);
	}

	public int compareTo(MatchResult arg0) {
		return (int) (Confidence * 10000000.0);
	}
}